<form id="twictures-search-form" action="<?php echo $form_action?>" method="post">
  <div class="twictures-search-widget">
    <div class="twictures-parameters">
      <ul>
        <li>
          <div class="twictures-parameters-step-title">
            <div class="twictures-parameters-step-number">1</div>
            <div class="twictures-parameters-step-description">Select the design you like</div>
          </div>
        </li>
        <li>
          <div class="twictures-parameters-step-title">
            <div class="twictures-parameters-step-number">2</div>
            <div class="twictures-parameters-step-description">Select size of the image</div>
          </div>
          <div class="twictures-parameters-step-content">
            Size:
            <select name="size_x" id="twictures_size_x">
              <option class="example" value="">W</option>

              <?php for ($i = 50; $i <= 300; $i += 50) {
                if (isset($_POST['size_x']) && $_POST['size_x'] == $i)
                  $selected = 'selected="selected"';
                else
                  $selected = '';

                echo "<option value=\"{$i}\" {$selected}>{$i}</option>";
              } ?>
            </select>
            &times;
            <select name="size_y" id="twictures_size_y">
              <option class="example" value="">H</option>

              <?php for ($i = 50; $i <= 300; $i += 50) {
                if (isset($_POST['size_y']) && $_POST['size_y'] == $i)
                  $selected = 'selected="selected"';
                else
                  $selected = '';

                echo "<option value=\"{$i}\" {$selected}>{$i}</option>";
              } ?>
            </select>
            px
          </div>
        </li>
        <li>
          <div class="twictures-parameters-step-title">
            <div class="twictures-parameters-step-number">3</div>
            <div class="twictures-parameters-step-description">Enter your twitter user name</div>
          </div>
          <div class="twictures-parameters-step-content">
            <div class="twictures-parameters-content-column">
              <label for="twictures_twitter">http://twitter.com/</label>
            </div>
            <div class="twictures-parameters-content-column">
            <?php
              $value = 'value="twitter user name"';
              $class = 'class="example"';

              if (isset($_POST['twitter'])) {
                $value = 'value="' . $_POST['twitter'] . '"';
                $class = '';
              }

              echo "<input type=\"text\" {$class} name=\"twitter\" id=\"twictures_twitter\" {$value} />";
            ?>
            </div>
            <div class="twictures-columns-end"></div>
          </div>
        </li>
      </ul>

      <div class="twictures-submit-box">
        <span class="twictures-generating-indicator hide">Generating&hellip;</span>
        <input type="submit" class="twictures-submit-button" id="twictures_submit" value="Get code" name="twictures_submit" />
      </div>

      <div class="twictures-results-box"></div>
    </div>

    <div class="twictures-templates-list">
      <table><tbody><tr>
      <?php
        $i = 1;
        foreach($templates as $template) { ?>
        <td>
          <div class="twictures-template-title">
            <input type="radio" name="template_id" value="<?php echo $template['id']?>" id="twictures_template_<?php echo $i?>" <?php if(isset($_POST['template_id']) and $_POST['template_id']==$template['id']) {echo 'checked="checked"';} ?> />
            <label for="twictures_template_<?php echo $i?>">
              <?php echo $template['title']?>
            </label>
          </div>
          <div>
            <a href="<?php echo $template['link']?>">
              <img src="<?php echo $template['thumbnail']?>" alt="<?php echo $template['title']?>" />
            </a>
          </div>
        </td>
      <?php 
        $i++;
      } ?>
      </tr></tbody></table>
    </div>
  </div>
    <input type="hidden" value="twictures_search_post" name="action">
</form>
